package geguol.cc.widgetapplication.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import java.util.ArrayList;
import java.util.List;

import geguol.cc.widgetapplication.R;
import geguol.cc.widgetapplication.bean.EmotionBean;
import geguol.cc.widgetapplication.widget.FaceLayout;
import geguol.cc.widgetapplication.widget.FaceStatisticsLayout;

public class RadioActivity extends AppCompatActivity {

	private FaceLayout faceLayout;
	private FaceStatisticsLayout faceStatisticsLayout;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_radio2);

		faceLayout = (FaceLayout) findViewById(R.id.my_btn);
		Button button1 = (Button) findViewById(R.id.can);
		Button button2 = (Button) findViewById(R.id.uncan);
		button1.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				faceLayout.setViewClickable(true);
			}
		});
		button2.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				faceLayout.setViewClickable(false);
			}
		});

		faceStatisticsLayout = (FaceStatisticsLayout) findViewById(R.id.face_statics);

		setData();
	}

	private void setData() {
		List<EmotionBean> beanList = new ArrayList<>();
		for (int i = 0; i < 5; i++) {
			EmotionBean bean = new EmotionBean(i,"10"+i);
			beanList.add(bean);
		}
		faceStatisticsLayout.setDate(beanList);
	}

	public void click1(View view){
		faceLayout.setValue(0);
	}
	public void click2(View view){
		faceLayout.setValue(1);
	}
	public void click3(View view){
		faceLayout.setValue(2);
	}
}
